#ifndef TEXTUREWIDGET_H
#define TEXTUREWIDGET_H

#include <QtOpenGL/QtOpenGL>
#include <cg/cg.h>
#include <cg/cgGL.h>

class TextureWidget : public QGLWidget
{
	Q_OBJECT

public:
	TextureWidget(QWidget *parent =0);
	~TextureWidget();

protected:
	void initializeGL();
	void resizeGL(int w , int h);
	void paintGL();

private:
	void initCG();
	void display();
	void drawModel();
	void initTexture();
	void checkForCgError(const char * situation);

private:
	CGcontext  fCgContext;
	CGprogram  fCgVertexProgram ;
	CGprogram  fCgFragmentProgram;
	CGprofile  fCgVertexProfile;
	CGprofile  fCgFragmentProfile;
	CGparameter  fCgFragmentParam_decal;
	CGparameter  fCgFragmentParam_enral;
	static const char * fCgProgramName;
	static const char * fCgVertexProgramFileName;
	static const char * fCgFragmentProgramFileName;
	static const char * fCgVertexProgramName;
	static const char * fCgFragmentProgramName;

	GLuint  fTextureId;
	GLuint  fTextureEnralId;
	static const GLubyte fDemonTextureData[3*(128*128)];
};

#endif // TEXTUREWIDGET_H
